﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using PublicTransportEnabler.net.Contract;
using PublicTransportEnabler.net.DataModel;
using PublicTransportEnabler.net.Enum;
using PublicTransportEnabler.net.Model;
using PublicTransportEnabler.net.Util;
using Location = PublicTransportEnabler.net.Model.Location;

namespace PublicTransportEnabler.net
{
    public abstract class AbstractNetworkProvider : INetworkProvider
    {
        protected static HashSet<Product> ALL_EXCEPT_HIGHSPEED;

        static AbstractNetworkProvider()
        {
            ALL_EXCEPT_HIGHSPEED = new HashSet<Product>(ProductHelper.ALL);
            ALL_EXCEPT_HIGHSPEED.Remove(Product.HIGH_SPEED_TRAIN);
        }

        public abstract NetworkId Id();
        public abstract bool HasCapabilities(IEnumerable<Capability> capabilities);
        public abstract DepartureMonitorRequest QueryNearbyStations(Location location, int maxDistance, int maxStations);
        public abstract DepartureMonitorRequest QueryDepartures(int stationId, int maxDepartures, bool equivs);
        public abstract StopFinderRequest AutocompleteStations(string constraint);

        public IEnumerable<Product> DefaultProducts()
        {
            return ALL_EXCEPT_HIGHSPEED.ToList();
        }

        public abstract TripRequest QueryConnections(Location from, Location via, Location to, DateTime date, bool dep,
                int numConnections, List<Product> products, WalkSpeed walkSpeed, Accessibility accessibility,
                HashSet<Option> options);

        public abstract QueryConnectionsResult QueryMoreConnections(IQueryConnectionsContext context, bool later, int numConnections);

        public virtual Style LineStyle(string line)
        {
            if (line.Length == 0)
                return null;

            return StandardColors.LINES[line[0]];
        }

        public PublicTransportEnabler.net.Model.Point[] GetArea()
        {
            return null;
        }
    }
}